package pers.xiaojun.boot.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import pers.xiaojun.boot.common.validation.ArrayValuable;

import java.util.Arrays;

/**
 * 性别枚举
 *
 * @author xiaojun
 * @since 2025-10-03
 */
@Getter
@AllArgsConstructor
public enum GenderEnum implements ArrayValuable<Integer> {

    MALE(1, "男"),

    FEMALE(2, "女"),

    UNKNOWN(0, "未知");

    private static final Integer[] ARRAY = Arrays.stream(values()).map(GenderEnum::getCode).toArray(Integer[]::new);

    /**
     * 性别代码
     */
    private final Integer code;

    /**
     * 名称
     */
    private final String name;


    @Override
    public Integer[] array() {
        return ARRAY;
    }
}
